﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string input=TextBox1.Text;
        if (input == "")
            input = "0";
        switch(Convert.ToInt32(input))
        {
            case 1:
            { 
                string script="alert('Incorrect')";
                if (TextBox2.Text == "3")
                {
                    Label1.Visible = Label7.Visible = false ;
                    script = "alert('Correct!')";                    
                }
                ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);                
            }break;
            case 2:
            {
                string script = "alert('Incorrect')";
                if (TextBox2.Text == "4")
                {
                    Label2.Visible = Label8.Visible = false;
                    script = "alert('Correct!')";
                }
                ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);                
            }break;
            case 3:
                {
                    string script = "alert('Incorrect')";
                    if (TextBox2.Text == "1")
                    {
                        Label3.Visible = Label5.Visible = false;
                        script = "alert('Correct!')";
                    }
                    ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);                
                } break;
            case 4:
                {
                    string script = "alert('Incorrect')";
                    if (TextBox2.Text == "2")
                    {
                        Label4.Visible = Label6.Visible = false;
                        script = "alert('Correct!')";
                    }
                    ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);                
                } break;
            default:
                {
                    string script = "alert('try again!')";
                    ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
                }break;                
        }
        TextBox1.Text = TextBox2.Text = "";
    }
}